import request from '@/utils/request'
import {  getDynamicRoutes } from '@/router'
import { deepClone } from '@/utils'

export function getRoutes() {
  // return request({
  //   url: '/vue-admin-template/routes',
  //   method: 'get'
  // })

  return {
    code: 20000,
    data: getDynamicRoutes()
  }
}

export function getRoles() {
  return request({
    url: 'roles',
    method: 'get'
  })
}

export function addRole(data) {
  return request({
    url: 'roles',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `roles`,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `roles/${id}`,
    method: 'delete'
  })
}

export function getOrganizes() {
  return request({
    url: 'tenants',
    method: 'get'
  })
}

export function addOrganize(data) {

  return request({
    url: 'tenants',
    method: 'post',
    data
  })
}

export function updateOrganize(id, data) {
  return request({
    url: `tenants`,
    method: 'put',
    data
  })
}

export function deleteOrganize(id) {
  return request({
    url: `tenants/${id}`,
    method: 'delete'
  })
}
